package echat.future.cn.echat.my.weight.wheel;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;

import java.util.List;

/**
 * 字符串选择
 */
public class StringWheelView extends WheelPicker<String>{
    private String item;
    public StringWheelView(Context context) {
        this(context,null);
    }

    public StringWheelView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs,0);
    }

    public StringWheelView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        setItemMaximumWidthText("00");
        setOnWheelChangeListener(new OnWheelChangeListener<String>() {
            @Override
            public void onWheelSelected(String item, int position) {
                StringWheelView.this.item = item;
            }
        });
    }

    public String getmSelectedText() {
        return item;
    }

    @Override
    public void setDataList(List<String> datas){
        super.setDataList(datas);
        setCurrentPosition(datas.size()/2);
        item = datas.get(datas.size()/2);
    }
}
